package algorithm;

import java.awt.Point;

public class N2DistanceFinder extends AbstractDistanceFinder {

	public Point[] findMinimumDistance(Point[] points) {
		double distance = Double.MAX_VALUE;
		double tmpDistance = 0;
		Point[] pts = new Point[2];
		for (int i = 0; i < points.length - 1; i++) {
			for (int j = i + 1; j < points.length; j++) {

				tmpDistance = calcDistance(points[i], points[j]);
				if (tmpDistance < distance) {
					distance = tmpDistance;
					pts[0] = points[i];
					pts[1] = points[j];
				}
			}
		}
		return pts;
	}

}
